package com.alameda.controller.manage;

import com.alameda.api.manage.TechnicalIndicatorService;
import com.alameda.manage.dto.TechnicalIndicatorDTO;
import com.alameda.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 技术指标 前端控制层
 *
 * @author Lv
 * @date 2024/08/04
 */
@Api(tags = "技术指标")
@RestController
@RequestMapping("/technical_indicator")
public class TechnicalIndicatorController {

    @Autowired
    private TechnicalIndicatorService technicalIndicatorService;

    /**
     * 查询技术指标列表
     *
     * @param technicalIndicatorDTO 技术指标数据传递对象
     * @return
     */
    @ApiOperation("查询技术指标列表")
    @PostMapping("/load_technical_indicator")
    public Result<?> loadTechnicalIndicator(@RequestBody TechnicalIndicatorDTO technicalIndicatorDTO) {
        return Result.success(technicalIndicatorService.loadTechnicalIndicator(technicalIndicatorDTO));
    }

    /**
     * 新增或修改技术指标
     *
     * @param technicalIndicatorDTO 技术指标数据传递对象
     * @return
     */
    @ApiOperation("新增或修改技术指标")
    @PostMapping("/save_or_update_technical_indicator")
    public Result<?> saveOrUpdateTechnicalIndicator(@RequestBody TechnicalIndicatorDTO technicalIndicatorDTO) {
        return Result.success(technicalIndicatorService.saveOrUpdateTechnicalIndicator(technicalIndicatorDTO));
    }

    /**
     * 导出技术指标信息
     *
     * @param technicalIndicatorDTO 技术指标数据传递对象
     */
    @ApiOperation("导出技术指标信息")
    @PostMapping("/export")
    public void export(@RequestBody TechnicalIndicatorDTO technicalIndicatorDTO) {
        technicalIndicatorService.export(technicalIndicatorDTO);
    }
}

